package web.User;

import services.UserServiceAll;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/ChangeUserState")
public class ChangeUserState extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int uid = Integer.parseInt(req.getParameter("changeUid"));
        boolean uState = Boolean.parseBoolean(req.getParameter("uState"));
        resp.setContentType("application/json");
        int num = new UserServiceAll().changeState(uid,uState);
        if(num>0){
            resp.getWriter().println("修改成功");
        }else{
            resp.getWriter().println("修改失败");
        }
    }
}
